<template>
  <div>
    <div ref="test">{{ count }}</div>
  </div>
</template>

<script>
import { ref, watchEffect } from 'vue'
export default {
  setup () {
    const count = ref(0)

    watchEffect(() => {
      console.log(count.value)
    })

    return {
      count
    }
  },
  onMounted () {
    watchEffect(() => {
      // 在这里可以访问到dom或者template refs
      console.log(this.$refs.test)
    })
  }
}
</script>
